package com.accp.crm.service;

import java.util.List;

import org.hibernate.SessionFactory;

import com.accp.crm.dao.CommonDAO;
import com.accp.crm.entity.SalPlan;


public class PlanService implements IPlanService {
    
	private CommonDAO<SalPlan> planDAO;
	
    public void setSessionFactory(SessionFactory sessionFactory){
    	planDAO=new CommonDAO<SalPlan>(sessionFactory, SalPlan.class);
    }
    
    public List findPlanById(Long id){
    	String hql="from SalPlan p where plaChcId=?";
    	return this.planDAO.findByHQL(hql, id);
    }
    
    public void Add(SalPlan plan){
    	this.planDAO.save(plan);
    }
    
    public SalPlan findById(Long id){
    	return this.planDAO.findById(id);
    }
    
    public void delete(Long id){
    	SalPlan plan=this.planDAO.findById(id);
    	this.planDAO.delete(plan);
    }
    
    public void update(SalPlan plan){
    	this.planDAO.update(plan);
    }
}
